# -*- coding: utf-8 -*-
import scrapy

from images360.items import PicItem


class PicSpider(scrapy.Spider):
    name = 'pic'
    allowed_domains = ['699pic.com/']
    start_urls = ['http://699pic.com/people-{0}-0-0-0-0-0-0.html'.format(str(i)) for i in range(1, 8)]

    def parse(self, response):
        all_img = response.css('#wrapper .swipeboxEx .list')
        for img in all_img:
            item = PicItem()
            item['title'] = img.css('.lazy::attr(alt)').extract_first()
            item['url'] = img.css('.lazy::attr("data-original")').extract_first()
            yield item
